// 去除字符转左右空格
function delTxtLrK(str) {
	return str.replace(/(^\s*)|(\s*$)/g, "");
}
// 去除字符串左边的空格
function delTxtLK(str) { //
	return str.replace(/(^\s*)/g, "");
}
// 去除字符串右边的空格
function delTxtRK(str) {
	return str.replace(/(\s*$)/g, "");
}
// 去除字符串所有的空格
function delTxtAllK(str) {
	return str.replace(/\s*/g, "")
}
// 复制信息
function copyInfo(info) {
	const cInput = document.createElement('input')
	cInput.value = info;
	document.body.appendChild(cInput)
	cInput.select() // 选取文本域内容;
	document.execCommand('Copy')
	cInput.remove()
}
// 移动端H5 复制信息方法=苹果*安卓
function phoneCopy(idName) {
	if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) { //区分iPhone设备
		// console.log('ios')
		window.getSelection().removeAllRanges(); //这段代码必须放在前面否则无效
		var Url2 = document.getElementById(idName); //要复制文字的节点
		var range = document.createRange();
		// 选中需要复制的节点
		range.selectNode(Url2);
		// 执行选中元素
		window.getSelection().addRange(range);
		// 执行 copy 操作
		var successful = document.execCommand('copy');

		// 移除选中的元素
		window.getSelection().removeAllRanges();
	} else {
		var text = document.getElementById(idName).innerText;
		const textarea = document.createElement("textarea");
		textarea.style.position = 'fixed';
		textarea.style.top = 0;
		textarea.style.left = 0;
		textarea.style.border = 'none';
		textarea.style.outline = 'none';
		textarea.style.resize = 'none';
		textarea.style.background = 'transparent';
		textarea.style.color = 'transparent';
		textarea.value = text; // 修改文本框的内容
		document.body.appendChild(textarea);
		textarea.select() // 选中文本
		try {
			const msg = document.execCommand('copy') ?
				'successful' : 'unsuccessful';
			// console.log('复制成功')
		} catch (err) {
			// console.log('复制失败')
		}
		document.body.removeChild(textarea)
	}
}
// 时间戳差值
function setTimeStamp(timeDiffer) {
	// timeDiffer两个时间戳(毫秒级)的减法

	//计算出相差天数
	var days = Math.floor(timeDiffer / (24 * 3600 * 1000))

	//计算出小时数
	var leave1 = timeDiffer % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
	// 小时
	var hours = Math.floor(leave1 / (3600 * 1000))

	//计算相差分钟数
	var leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数
	// 分钟
	var minutes = Math.floor(leave2 / (60 * 1000))

	//计算相差秒数
	var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
	// 秒数
	var seconds = Math.round(leave3 / 1000)

	// (" 相差 "+days+"天 "+hours+"小时 "+minutes+" 分钟"+seconds+" 秒")
	return [days, hours, minutes];


}
// 时间戳===转===YYYY-MM-DD hh:mm:ss
function timestampToTime(timestamp) {
	if (!timestamp) {
		return false;
	} else if (timestamp.length == 10) {
		var date = new Date(timestamp * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
	} else {
		var date = new Date(timestamp);
	}
	var Y = date.getFullYear() + '-';
	var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
	var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
	var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
	var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
	var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
	return Y + M + D + h + m + s;
}
// 时间戳===转===YYYY-MM-DD
function timestampToTimeDate(timestamp) {
	if (!timestamp) {
		return false;
	} else if (timestamp.length == 10) {
		var date = new Date(timestamp * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
	} else {
		var date = new Date(timestamp);
	}
	var Y = date.getFullYear() + '-';
	var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
	var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
	return Y + M + D;
}
// 时间戳===转===YYYY-MM-DD
function timestampToTimeHour(timestamp) {
	if (!timestamp) {
		return false;
	} else if (timestamp.length == 10) {
		var date = new Date(timestamp * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
	} else {
		var date = new Date(timestamp);
	}
	var Y = date.getFullYear() + '-';
	var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
	var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
	var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
	var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
	var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
	return h + m + s;
}

// 标准时间===转===YYYY-MM-DD hh:mm:ss
function timestampToTimeB(timestamp) {
	if (!timestamp) {
		return false;
	} else {
		let time = new Date(timestamp)
		var y = time.getFullYear();
		var m = time.getMonth() + 1;
		m = m < 10 ? ('0' + m) : m;
		var d = time.getDate();
		d = d < 10 ? ('0' + d) : d;
		// var h = time.getHours();
		// h = h < 10 ? ('0' + h) : h;
		// var min = time.getMinutes();
		// min = min < 10 ? ('0' + min) : min;
		// var s = time.getSeconds();
		// s = s < 10 ? ('0' + s) : s;
		return y + '-' + m + '-' + d;
	}
}
// 标准时间===转===DD
function timestampToTimeDay(timestamp) {
	if (!timestamp) {
		return false;
	} else {
		let time = new Date(timestamp)
		var y = time.getFullYear();
		var m = time.getMonth() + 1;
		m = m < 10 ? ('0' + m) : m;
		var d = time.getDate();
		d = d < 10 ? ('0' + d) : d;
		// var h = time.getHours();
		// h = h < 10 ? ('0' + h) : h;
		// var min = time.getMinutes();
		// min = min < 10 ? ('0' + min) : min;
		// var s = time.getSeconds();
		// s = s < 10 ? ('0' + s) : s;
		return d;
	}
}
// 获取周-前后加减
function timesWeek() {
	const time = new Date(),
		day = time.getDay(),
		s = time.getTime(),
		weekData = [1, 2, 3, 4, 5, 6, 0]
	// weekData.indexOf(day) 判断当前日期在本周位置
	const week = weekData.map((item, index) => {
		let itemTime;
		if (index < weekData.indexOf(day)) {
			// index < weekData.indexOf(day) 说明是在当前日期之前
			itemTime = new Date(s - (weekData.indexOf(day) - index) * 86400000)
		} else {
			// index >= weekData.indexOf(day) 说明是在当前日期之后
			itemTime = new Date(s + (index - weekData.indexOf(day)) * 86400000)
		}
		// 在这个位置转换
		return this.timestampToTimeDay(itemTime)
		// return itemTime
	})
	return week
}
function timesWeekTwo() {
	const time = new Date(),
		day = time.getDay(),
		s = time.getTime(),
		weekData = [1, 2, 3, 4, 5, 6, 0]
	// weekData.indexOf(day) 判断当前日期在本周位置
	const week = weekData.map((item, index) => {
		let itemTime;
		if (index < weekData.indexOf(day)) {
			// index < weekData.indexOf(day) 说明是在当前日期之前
			itemTime = new Date(s - (weekData.indexOf(day) - index) * 86400000)
		} else {
			// index >= weekData.indexOf(day) 说明是在当前日期之后
			itemTime = new Date(s + (index - weekData.indexOf(day)) * 86400000)
		}
		// 在这个位置转换
		return this.timestampToTimeDay(itemTime)
		// return itemTime
	})
	return week
}
// 获取周-前后加减-全部日期
function timesWeeks() {
	const time = new Date(),
		day = time.getDay(),
		s = time.getTime(),
		weekData = [1, 2, 3, 4, 5, 6, 0]
	// weekData.indexOf(day) 判断当前日期在本周位置
	const week = weekData.map((item, index) => {
		let itemTime;
		if (index < weekData.indexOf(day)) {
			// index < weekData.indexOf(day) 说明是在当前日期之前
			itemTime = new Date(s - (weekData.indexOf(day) - index) * 86400000)
		} else {
			// index >= weekData.indexOf(day) 说明是在当前日期之后
			itemTime = new Date(s + (index - weekData.indexOf(day)) * 86400000)
		}
		// 在这个位置转换
		return this.timestampToTimeDate(itemTime)
		// return itemTime
	})
	return week
}
function timesWeekA(monthab) {
	const time = new Date(),
		day = time.getDay(),
		// s = time.getTime(),
		s = Date.parse(new Date(monthab)),
		weekData = [1, 2, 3, 4, 5, 6, 0]
	// let nomore = new Date(monthab)
		console.log(s,'day');
	// weekData.indexOf(day) 判断当前日期在本周位置
	const week = weekData.map((item, index) => {
		let itemTime;
		if (index < weekData.indexOf(day)) {
			// index < weekData.indexOf(day) 说明是在当前日期之前
			itemTime = new Date(s - (weekData.indexOf(day) - index) * 86400000)
		} else {
			// index >= weekData.indexOf(day) 说明是在当前日期之后
			itemTime = new Date(s + (index - weekData.indexOf(day)) * 86400000)
		}
		// 在这个位置转换
		return this.timestampToTimeDate(itemTime)
		// return itemTime
	})
	return week
}

function  getWeeks(time,yearMonthDay) {
	console.log('yearMonthDay: ',yearMonthDay);
 //time = 7下周  -7上周   0本周
		let thisWeek = []
      let date = new Date(); //this.chaoZuoTime
      let currentFirstDate = new Date(date);

      let formatDate = function(date) {
        // console.log(date);
        let year = date.getFullYear(); //年
        let month = date.getMonth() + 1; //月
        let day = date.getDate(); //日;
        // let arr = ["日", "一", "二", "三", "四", "五", "六"];
        let week = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"][
          date.getDay()
        ];
        //我需要的格式是  （周几 月.日） 这里看你们的需求
        return yearMonthDay.substring(0,8)+day;
      };

      let addDate = function(date, n) {
        // console.log(date.getDate() + n);
        date.setDate(date.getDate() + n);
        return date;
      };

      let setDate = function(date) {
        let week = date.getDay() - 1;
        date = addDate(date, week * -1);
        currentFirstDate = new Date(date);
        let weekList = [];
        for (let i = 0; i < 7; i++) {
          weekList[i] = formatDate(i == 0 ? date : addDate(date, 1));
        }
        return weekList;
      };

      // let upWeek = setDate(addDate(currentFirstDate, -7));
      thisWeek = setDate(addDate(currentFirstDate, time)); //本周
      // let nextWeek = setDate(addDate(currentFirstDate, 7)); //下周
      // let today = formatDate(date); //今日日期
      // console.log(thisWeek);
	  return thisWeek
    }


// 数字过滤====万单位
function numGlW(num) {
	if (num == '') {
		return ''
	} else if (num < 10000) {
		return num;
	} else if (num == 10000) {
		return '1万'
	} else if (num > 10000) {
		num = Math.round(num / 100) / 100;
		return num + '万';
	}
}
// 计算视频显示时长
function countTimeTxt(time) {
	// time时长===总秒数

	if (!time) {
		return false;
	}

	// 定义显示时长
	let vite;
	// 是否大于一分钟
	if (time >= 60) {
		// 获取分钟数
		let fzNum = parseInt(time / 60);
		// 获取秒数
		let msNum = parseInt(time % 60);

		// 判断分钟
		if (fzNum >= 10) {
			vite = fzNum + ':';
		} else {
			vite = '0' + fzNum + ':';
		}
		// 判断秒数
		if (msNum >= 10) {
			vite = vite + msNum;
		} else {
			vite = vite + '0' + msNum;
		}
	} else {
		// 小于一分钟

		// 获取秒数
		let msNum = parseInt(time % 60);
		// 判断秒数
		if (msNum >= 10) {
			vite = '00:' + msNum;
		} else {
			vite = '00:0' + msNum;
		}
	}
	return vite;
}

// 验证手机号
function verPhoneCode(val) {
	const regPhone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
	return regPhone.test(val);
}

// 验证邮箱
function checkEmail(val) {
	var regEmail = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
	return regEmail.test(val)
}


// 验证当前系统类型
function browserRedirect() {
	var sUserAgent = navigator.userAgent.toLowerCase();
	var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
	var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
	var bIsMidp = sUserAgent.match(/midp/i) == "midp";
	var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
	var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
	var bIsAndroid = sUserAgent.match(/android/i) == "android";
	var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
	var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
	document.writeln("您的浏览设备为：");
	if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
		document.writeln("phone");
	} else {
		document.writeln("pc");
	}
}
// 判断类型
function pdType() {
	var u = navigator.userAgent
	var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
	var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
	if (isAndroid) {
		return "安卓机"
	}
	if (isIOS) {
		return "苹果机"
	}
}

function sTypePd() {
	var iosReg = /(iPhone|iPad|iPod|iOS)/i
	var andReg = /(Android)/i
	if (iosReg.test(navigator.userAgent)) {
		return 1
	} else if (andReg.test(navigator.userAgent)) {
		return 2
	} else {
		return 3
	}
}
// 退出全屏
function checkFull() {
	var isFull =
		document.fullscreenElement ||
		document.mozFullScreenElement ||
		document.webkitFullscreenElement
	if (isFull === undefined) isFull = false
	return isFull
}

function fullScreen(el) {
	var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen,
		wscript;

	if (typeof rfs != "undefined" && rfs) {
		rfs.call(el);
		return;
	}

	if (typeof window.ActiveXObject != "undefined") {
		wscript = new ActiveXObject("WScript.Shell");
		if (wscript) {
			wscript.SendKeys("{F11}");
		}
	}
}
// 过滤手机号
function hidePhone(phone) {
	var reg = /^(\d{3})\d{4}(\d{4})$/;
	return phone.replace(reg, "$1****$2")
}
// app===计算缓存,不可用
function formatSize() {
	plus.cache.calculate(function(size) {
		let sizeCache = parseInt(size);
		if (sizeCache == 0) {
			_self.fileSizeNum = "0B";
		} else if (sizeCache < 1024) {
			_self.fileSizeNum = sizeCache + "B";
		} else if (sizeCache < 1048576) {
			_self.fileSizeNum = (sizeCache / 1024).toFixed(2) + "KB";
		} else if (sizeCache < 1073741824) {
			_self.fileSizeNum = (sizeCache / 1048576).toFixed(2) + "MB";
		} else {
			_self.fileSizeNum = (sizeCache / 1073741824).toFixed(2) + "GB";
		}
	});
}
// 清除缓存
function delCache() {
	var that = this;
	let os = plus.os.name;
	if (os == 'Android') {
		let main = plus.android.runtimeMainActivity();
		let sdRoot = main.getCacheDir();
		let files = plus.android.invoke(sdRoot, "listFiles");
		let len = files.length;
		for (let i = 0; i < len; i++) {
			let filePath = '' + files[i]; // 没有找到合适的方法获取路径，这样写可以转成文件路径 
			plus.io.resolveLocalFileSystemURL(filePath, function(entry) {
				if (entry.isDirectory) {
					entry.removeRecursively(function(entry) { //递归删除其下的所有文件及子目录 
						uni.showToast({
							title: '缓存清理完成',
							duration: 2000
						});
						return true;
					}, function(e) {
						// console.log(e.message)
					});
				} else {
					entry.remove();
				}
			}, function(e) {
				// console.log('文件路径读取失败')
			});
		}
	} else { // ios 
		plus.cache.clear(function() {
			uni.showToast({
				title: '缓存清理完成',
				duration: 2000
			});
			return true;
		});
	}
}
// 页面自定义title
function getTitHei() {
	let arr = [];
	// 手机信息
	let phoneInfo = uni.getSystemInfoSync();
	// 胶囊信息
	let jnInfo = uni.getMenuButtonBoundingClientRect();
	// 添加状态栏高度
	let tHei = phoneInfo.statusBarHeight;
	arr.push(tHei);
	// 添加胶囊行高度
	let bHei = (jnInfo.top - phoneInfo.statusBarHeight) * 2 + jnInfo.height;
	arr.push(bHei);
	// 添加总和
	let sum = tHei + bHei;
	arr.push(sum);

	return arr;
}
// 历史搜索数组===小程序
function lsArrEdit(crtArr = [], addVal, storageName, maxLength = 8) {
	// crtArr当前数组====addVal添加内容
	// storageName本地存储名称===maxLength数组最大长度
	if (crtArr && !crtArr.length) {
		// 历史数组中抛进=
		crtArr.push(addVal);
	} else if (crtArr && crtArr.length && crtArr.length < maxLength) {
		// 历史数组中抛进=
		crtArr.unshift(addVal);
	} else {
		// 转义处理数组
		let newArr = JSON.parse(JSON.stringify(crtArr));
		// 删除最后一个
		newArr.splice(-1, 1)
		// 向前添加
		newArr.unshift(addVal);

		crtArr = newArr;
	}
	// 本地存储
	uni.setStorageSync(storageName, crtArr);
	// 抛出最新数组
	return crtArr;
}
// 小程序====解析页面传值
function jxPageInfo(val) {
	return JSON.parse(decodeURIComponent(val.data || ''))
};

var returnImgArr, upOptions;
// 上传图片
async function handleUpImg(num, upImgOptins, type) {
	upOptions = upImgOptins;
	returnImgArr = [];
	return new Promise(resolve => {
		if (type == 1) {
			// 图片上传
			uni.chooseImage({
				count: num,
				sourceType: ['album'],
				success(tes) {

					// 开启加载状态
					uni.showLoading({
						title: '加载中',
						mask: true
					})
					// 递归==上传图片
					handleUpImgDg(tes.tempFilePaths).then(res => {
						return resolve(returnImgArr)
					})
				}
			});
		} else if (type == 2) {
			// 视频上传
			uni.chooseVideo({
				sourceType: ['album'],
				success: function(tes) {
					// 开启加载状态
					uni.showLoading({
						title: '加载中',
						mask: true
					})
					// 递归==上传图片
					handleUpVideo(tes).then(res => {
						return resolve(returnImgArr)
					})
				}
			});
		}
	})
};
// 递归上传图片
function handleUpImgDg(imgArr) {
	if (!upOptions || !upOptions.baseUrl || !imgArr || imgArr && !imgArr.length) {
		showTips('上传错误，请重新上传');
		uni.hideLoading()
		return false;
	}
	return new Promise((resolve, rej) => {
		// let data.imgArr = imgArr[0]
		uni.uploadFile({
			url: upOptions.baseUrl, //post请求的地址
			filePath: imgArr[0],
			name: upOptions.baseName,
			header: {
				// "Content-Type": "multipart/form-data",
				Authorization: upOptions.token
			},
			// formData: {
			// 	Authorization: upOptions.token
			// },
			timeout: 60000,
			success: (uploadFileRes) => {
				if (uploadFileRes.statusCode == 200) {
					let upInfo = JSON.parse(uploadFileRes.data);
					if (upInfo.code == 200) {
						returnImgArr = upInfo.url;
					} else {
						// 提示错误
						showTips('上传失败')
					}
				} else {
					// 提示错误 
					showTips('上传失败')
				}
			},
			complete: (res) => {
				let newArr = JSON.parse(JSON.stringify(imgArr));
				newArr.splice(0, 1);
				// 判断是否有无，
				if (newArr.length) {
					// 	// 还有
					handleUpImgDg(newArr);

				} else {
					// 	// 没有了
					uni.hideLoading();
				}
				setTimeout(() => {
					return resolve(returnImgArr)
				}, 200)
			}
		})
	})
};
// 上传视频处理
function handleUpVideo(imgArr) {
	if (!upOptions || !upOptions.baseUrl || !imgArr) {
		showTips('上传错误，请重新上传');
		uni.hideLoading()
		return false;
	}
	// console.log('上传参数====',[upOptions,imgArr]);
	return new Promise((resolve, rej) => {
		uni.uploadFile({
			url: upOptions.baseUrl, //post请求的地址
			file: imgArr,
			filePath: imgArr.tempFilePath,
			name: upOptions.baseName,
			fileType: 'video',
			header: {
				"Content-Type": "multipart/form-data",
				token: upOptions.token
			},
			formData: {
				token: upOptions.token
			},
			timeout: 60000,
			success: (uploadFileRes) => {
				// console.log('上传====走成功事件',uploadFileRes);
				if (uploadFileRes.statusCode == 200) {
					let upInfo = JSON.parse(uploadFileRes.data);
					// console.log('上传成功===',upInfo)
					if (upInfo.error_code == 200) {
						returnImgArr.push(upInfo.data);
					} else {
						// 提示错误
						showTips('上传失败')
					}
				} else {
					// 提示错误 
					showTips('上传失败')
				}
			},
			complete: (all) => {
				// console.log('上传视频====',all);
				setTimeout(() => {
					uni.hideLoading();
					return resolve(returnImgArr)
				}, 200)
			}
		})
	})
}

// 加载中
function sLoad(txt) {
	txt ? txt : txt = '加载中'
	return uni.showLoading({
		title: txt,
		mask: true
	})
}

function showTips(txtVal, timeVal = 2000, ico = 'none') {
	return uni.showToast({
		title: txtVal,
		icon: ico,
		mask: true,
		duration: timeVal
	})
}

//防抖原理：一定时间内，只有最后一次操作，再过times毫秒后才执行函数
// 执行函数  时间      是否立即执行
let timeouts

function debounce(func, times = 500, immediate = false) {
	// 清除定时器
	if (timeouts !== null) clearTimeout(timeouts);

	// 立即执行，传true 则不进行防抖 一般不传递第三个参数
	if (immediate) {
		var callNow = !timeouts;
		timeouts = setTimeout(function() {
			timeouts = null;
		}, times);
		if (callNow) typeof func === 'function' && func();
	} else {
		// 设置定时器，当最后一次操作后，timeouts不会再被清除，所以在延时times毫秒后执行func回调方法
		timeouts = setTimeout(function() {
			typeof func === 'function' && func();
		}, times);
	}
}
// 延迟-防抖2
let timers, clickStates;

function funYc(func, wait) {
	if (!clickStates) {
		clickStates = true;
		timers && clearTimeout(timers);
		timers = setTimeout(() => {
			func();
			clickStates = false
		}, wait)
	}
}

// 跳转
// Vue.prototype.goUrl = function(status, url, data=null) {
function goUrl(status, url, data = null) {
	// 判断状态值
	if (!status) {
		// store.commit('setisState', !store.getters.getisState)
		// 状态0==返回上一级页面
		uni.navigateBack({
			delta: 1
		})
	} else if (status == 1) {

		let pageInfo = getCurrentPages();
		if (pageInfo && pageInfo.length > 7) {
			//停止继续执行
			return false;
		} else {
			// 状态1==navigateTo跳转
			uni.navigateTo({
				url: url + '?data=' + encodeURIComponent(JSON.stringify(data))
			})
		}
	} else if (status == 2) {
		// 状态2==switch跳转
		uni.switchTab({
			url: url
		})
	} else if (status == 3) {
		// 状态3==清除所有跳转页面
		uni.reLaunch({
			url: url + '?data=' + encodeURIComponent(JSON.stringify(data))
		})
	} else if (status == 4) {
		// 删除当前页面跳转
		uni.redirectTo({
			url: url + '?data=' + encodeURIComponent(JSON.stringify(data))
		})
	}
}



//封装分享
function wxOnShareAppMessage(share_title, share_path, share_imageUrl) {
	return {
		title: share_title,
		path: share_path,
		imageUrl: share_imageUrl,
	};
}

function getNowTime() {
	let date = new Date().toISOString();
	let time = new Date(date)
	let nowTime = time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + time.getDate() + ' ' + time.getHours() +
		':' + time.getMinutes() + ':' + time.getSeconds()
	return nowTime
}
// 计算与当前时间差多少
function timeago(datetime) { //dateTimeStamp是一个时间毫秒，注意时间戳是秒的形式，在这个毫秒的基础上除以1000，就是十位数的时间戳。13位数的都是时间毫秒。
	var dateTimeStamp = new Date(datetime.replace(/ /, 'T')).getTime() - 8 * 60 * 60 * 1000; //这里要减去中国的时区8小时
	var minute = 1000 * 60; //把分，时，天，周，半个月，一个月用毫秒表示
	var hour = minute * 60;
	var day = hour * 24;
	var week = day * 7;
	var halfamonth = day * 15;
	var month = day * 30;
	var now = new Date().getTime(); //获取当前时间毫秒
	var diffValue = now - dateTimeStamp; //时间差

	if (diffValue < 0) {
		return '刚刚';
	}
	var minC = diffValue / minute; //计算时间差的分，时，天，周，月
	var hourC = diffValue / hour;
	var dayC = diffValue / day;
	var weekC = diffValue / week;
	var monthC = diffValue / month;
	var result = "2";
	if (monthC >= 1 && monthC <= 3) {
		result = " " + parseInt(monthC) + "月前"
	} else if (weekC >= 1 && weekC <= 3) {
		result = " " + parseInt(weekC) + "周前"
	} else if (dayC >= 1 && dayC <= 6) {
		result = " " + parseInt(dayC) + "天前"
	} else if (hourC >= 1 && hourC <= 23) {
		result = " " + parseInt(hourC) + "小时前"
	} else if (minC >= 1 && minC <= 59) {
		result = " " + parseInt(minC) + "分钟前"
	} else if (diffValue >= 0 && diffValue <= minute) {
		result = "刚刚"
	} else {
		var datetime = new Date();
		datetime.setTime(dateTimeStamp);
		var Nyear = datetime.getFullYear(); {}
		var Nmonth = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
		var Ndate = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
		var Nhour = datetime.getHours() < 10 ? "0" + datetime.getHours() : datetime.getHours();
		var Nminute = datetime.getMinutes() < 10 ? "0" + datetime.getMinutes() : datetime.getMinutes();
		var Nsecond = datetime.getSeconds() < 10 ? "0" + datetime.getSeconds() : datetime.getSeconds();
		result = Nyear + "-" + Nmonth + "-" + Ndate
	}
	return result;
}


export default {
	delTxtLrK, //清除左右空格
	delTxtRK, //清除右侧
	delTxtLrK, //清除左侧
	delTxtAllK, //清除全部
	setTimeStamp, //时间戳只差转换[天，小时，分钟]
	copyInfo, //web复制信息
	phoneCopy, //移动端复制信息
	verPhoneCode, //验证手机号
	timestampToTime, //时间戳转标准格式
	numGlW, //过滤数字===万单位
	browserRedirect, //验证系统类型
	pdType, //同上
	sTypePd, //同上
	checkFull, //判断是否全屏
	fullScreen,
	hidePhone, //过滤手机号
	formatSize, //app计算手机缓存
	delCache, //清除缓存
	countTimeTxt, //计算视频时长
	getTitHei, //小程序端自定义title
	lsArrEdit, //小程序==历史搜索处理
	jxPageInfo, //小程序===页面传值
	handleUpImg, //小程序===选择图片
	handleUpImgDg, //小程序===递归上传
	sLoad, //加载中
	showTips, //showToast
	goUrl, //跳转
	debounce, //防抖函数1
	funYc, //延迟-防抖函数2
	wxOnShareAppMessage, //分享
	getNowTime, //获取当前时间
	timestampToTimeB, //标准时间转换时间戳
	timesWeek, //获取周
	timestampToTimeDate, //时间戳转换-年月日
	checkEmail, //验证邮箱
	timestampToTimeDay,
	timestampToTimeHour,
	timeago,//日期转几分钟前、几小时前
	timesWeeks,//全部日期
	timesWeekA,//传值全部日期
	getWeeks,
}